﻿@{
    ViewBag.Title = "Common Command";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
        <ol class="breadcrumb">
            <li><a href="/Home.html">Home</a></li>
            <li><a href="/WebApp/WebApi"> Sanelib WebApp</a></li>
            <li class="active">Execution Policy</li>
        </ol>
      
            <div id="introduction">
                <h1 class="text-left">Execution Policy</h1>
            </div>
            <div>
                <p>
                    Windows PowerShell does not allow Scripts, Which are not Signed Because it can be dangerous for the system. Even if you download a script from the internet it would not allow it to run because the scripts would not have its certificates.
                </p>
                <p>
                    To Configure your PowerShell to run scripts you write. Following Steps will Configure your PowerShell for execution policy.
                </p>
                <article>
                    First, Know your Windows PowerShell Current configuration. if your are a total new to <abbr title="Windows PowerShell">WPS</abbr> it would be configred to Restricted as default.
                    <h3>Step 1:</h3>
                    On Command Line Write : <br />
                    <pre><code>Get-ExecutionPolicy</code></pre>
                    This will check the current system policy setting.<br />
                    E.g. “Restricted” means you cannot run scripts.<br />
                    <img src="~/Images/Wps/Exec_Policy_1.png" id="ExecPol_Img1" class="img-thumbnail" />
                    This command will show you your system Execution Policy.
                </article>
            </div>
            <div id="ExecutionModes">
                <h3>There are four Execution Modes</h3>
                <ol start="1">
                    <li><strong>Restricted: </strong>Default execution policy, does not run scripts, interactive commands only.</li>
                    <li><strong>AllSigned: </strong>Runs scripts; all scripts and configuration files must be signed by a publisher that you trust; opens you to the risk of running signed (but malicious) scripts, after confirming that you trust the publisher.</li>
                    <li><strong>RemoteSigned</strong>Local scripts run without signature. Any downloaded scripts need a digital signature, even a UNC path.</li>
                    <li><strong>UnSigned</strong>No restrictions; all Windows PowerShell scripts can be run.</li>
                </ol>
                <p><h4>Option</h4><br /><pre><code>Get-ExecutionPolicy -List</code></pre></p>
                <table class="table table-condensed">
                    <tr>
                        <td><strong>Scope</strong></td>
                        <td><strong>Execution Policy</strong></td>
                    </tr>
                    <tr>
                        <td class="active">MachinePolicy</td>
                        <td>Undefined</td>
                    </tr>
                    <tr>
                        <td class="active"> UserPolicy</td>
                        <td>Undefined</td>
                    </tr>
                    <tr>
                        <td class="active">Process</td>
                        <td>Undefined</td>
                    </tr>
                    <tr>
                        <td class="active">CurrentUser</td>
                        <td>RemoteSigned</td>
                    </tr>
                    <tr>
                        <td class="active">Local Machine</td>
                        <td>AllSigned</td>
                    </tr>
                </table>
                <p>Let's take a quick view of my execution policy.</p>
                <img src="~/Images/Wps/Exec_Policy_2.png" class="img-thumbnail" />
            </div>

            
            <div id="step2">
                <h3>Step 2:</h3>
                <p>Now next step is to Set your Execution Policy.</p>
                <pre><code>Set-ExecutionPolicy –Scope CurrentUser</code></pre>
                <p class="text-warning">
                    In Windows Vista and later versions of Windows, to run
                    commands that change the execution policy for the local
                    computer (the default), start Windows PowerShell with the
                    "Run as administrator" option.
                </p>
                <img src="~/Images/Wps/Exec_Policy_3.png" class="img-thumbnail" />
            </div>
            <div id="step3">
                <p>As soon as you will enter above command you will be asked for confirmation.</p>
                A.	Yes<br />
                B.	No<br />
                C.	Suspend<br />
                D.	Default is Yes If you hit enter.<br />

                <img src="~/Images/Wps/Exec_Policy_4.png" class="img-thumbnail" />
                <p class="alert-success">Now you would have successfully configred your Windows PowerShell Exection Policy with just two quick easy step.</p>
                <p class="alert-info">Applies to PowerShell Version 2.0, 3.0, 4.0</p>
            </div>
       